#include "ALPORB.h"

CALPORB::CALPORB()
{
}

CALPORB::CALPORB(CALStepItem* pStepItem)
{
	m_pStepItem = pStepItem;
}

CALPORB::~CALPORB()
{
}


void CALPORB::test()
{

}

void CALPORB::convert()
{
	if (m_pStepItem == NULL) return;

	try
	{
		CALSIPORB* pStepItem = (CALSIPORB*)m_pStepItem;

		if (pStepItem != NULL)
		{
			int nfeatures = pStepItem->GetItemFeatures();
			float scaleFactor = pStepItem->GetItemScaleFactor();
			int nlevels = pStepItem->GetItemLevels();
			int edgeThreshold = pStepItem->GetItemEdgeThreshold();
			int firstLevel = pStepItem->GetItemFirstLevel();
			int WTA_K = pStepItem->GetItemWTA_K();
			ORB::ScoreType scoreType = (ORB::ScoreType)pStepItem->GetItemScoreType();
			int patchSize = pStepItem->GetItemPatchSize();
			int fastThreshold = pStepItem->GetItemFastThreshold();

			//int nfeatures = 500;
			//float scaleFactor = 1.2f;
			//int nlevels = 8;
			//int edgeThreshold = 31;
			//int firstLevel = 0;
			//int WTA_K = 2;
			//ORB::ScoreType scoreType = ORB::HARRIS_SCORE;
			//int patchSize = 31;
			//int fastThreshold = 20;

			std::vector<KeyPoint> keyPoints;
			Ptr<ORB> fast = ORB::create(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, WTA_K, scoreType, patchSize, fastThreshold);
			fast->detect(m_srcMat, keyPoints);

			drawKeypoints(m_srcMat, keyPoints, m_dstMat, Scalar::all(255), DrawMatchesFlags::DEFAULT);

			SetDstType(AL_DST_Mat_One);
		}

	}
	catch (...)
	{

	}
}

void CALPORB::convert(const Mat &src, Mat &dst)
{

}